<template>
  <div>
    <c-search-form @keyup-enter="GetParam" ref="searchform" :isMulDepartment="false" :isBillNo="false" />
    <c-table buttontitle="返回" :showSelection="false" @get-back="gotoback" :data="list" @row-dblclick="rowdblclick"
      :total="total" :page-size="pagesize" :buttonEnable="{}" @current-change="currentChange"
      @size-change="siezeChange">
      <template slot="button">
        <c-button @click="SearchGetParam">搜索</c-button>
      </template>
      <c-table-column prop="billNo" label="单号" minWidth="150px" />
      <c-table-column-enum prop="billStatus" label="单据状态" type="SysBillStatus" />
      <c-table-column-basdepart prop="basDepartmentId" />
      <c-table-column prop="name" label="姓名" />
      <c-table-column prop="hospitalNumber" label="住院号" />
      <c-table-column-user prop="creatorUserId" label="开单人" />
      <c-table-column prop="creationTime" label="开单时间" />
    </c-table>
  </div>
</template>
<script>
export default {
  props: {
    commandObj: {},
  },
  components: {},
  name: '',
  filters: {},
  data() {
    return {
      searchParam: { maxResultCount: 10 },
      checkParam: {
        billNo: undefined,
        patientName: undefined,
        basDepartmentId: undefined,
        hospitalNumber: undefined,
        billStatus: 3,
        skipCount: undefined,
        maxResultCount: 10,
        startTime: undefined,
        endTime: undefined,
        basDepartmentList: [],
      },
      ztxlist: [],
      options: [],
      applyType: 0,
      list: [],
      total: 0,
      pagesize: 10,
      currentsize: 1,
    }
  },
  computed: {},
  watch: {},
  methods: {
    gotoback() {
      this.$emit('goto-edit')
    },
    add() {},
    currentChange(value) {
      this.currentsize = value
      this.Search()
    },
    siezeChange(value) {
      this.pagesize = value
      this.Search()
    },
    buttonSearch() {
      this.currentsize = 1
      this.Search()
    },
    GetParam(value) {
      Object.keys(value).forEach((key) => {
        this.checkParam[key] = value[key]
      })
      this.currentsize = 1
      this.Search()
    },
    SearchGetParam() {
      this.$refs.searchform.enterParam()
    },
    Search() {
      this.checkParam.skipCount = this.pagesize * (this.currentsize - 1)
      this.checkParam.maxResultCount = this.pagesize

      // GetAllIsMessage(this.checkParam).then((re) => {
      //   this.list = re.result.items
      //   this.total = re.result.totalCount
      //   this.$refs.searchform.SetDepartmentlistNull()
      // })
    },

    rowdblclick(row) {
      //判断是否能打印
      this.$emit('goto-edit', row)
    },
  },
}
</script>